package com.kingdee.eas.custom.hr.attendance.app;

import java.util.Iterator;
import java.util.Set;

import org.apache.log4j.Logger;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.hr.attendance.SickVacationMgrCollection;
import com.kingdee.eas.custom.hr.attendance.SickVacationMgrInfo;
import com.kingdee.eas.framework.CoreBaseCollection;

public class SickVacationMgrControllerBean extends
		AbstractSickVacationMgrControllerBean {
	private static Logger logger = Logger
			.getLogger("com.kingdee.eas.custom.hr.attendance.app.SickVacationMgrControllerBean");

	@Override
	public void saveSickVacationMgr(Context ctx,
			SickVacationMgrInfo sickVacationMgr) throws BOSException,
			EASBizException {
		super.saveSickVacationMgr(ctx, sickVacationMgr);

		Set addSet = (Set) sickVacationMgr.get("addSet");
		Set updateSet = (Set) sickVacationMgr.get("updateSet");
		Set deleteSet = (Set) sickVacationMgr.get("deleteSet");

		Iterator it = addSet.iterator();
		SickVacationMgrInfo info = null;

		SickVacationMgrCollection colls = new SickVacationMgrCollection();
		while (it.hasNext()) {
			info = (SickVacationMgrInfo) it.next();
			colls.add(info);
		}
		this._saveBatchData(ctx, colls);

		IObjectPK[] pks = new ObjectUuidPK[deleteSet.size()];
		int i = 0;
		it = deleteSet.iterator();
		while (it.hasNext()) {
			info = (SickVacationMgrInfo) it.next();
			pks[i++] = new ObjectUuidPK(info.getId());
		}
		this.deleteBatchData(ctx, pks);

		CoreBaseCollection collection = new CoreBaseCollection();
		it = updateSet.iterator();
		while (it.hasNext()) {
			info = (SickVacationMgrInfo) it.next();
			collection.add(info);
		}

		this.updateBatchData(ctx, collection);

	}
}